import request from '@/utils/request'

// 获取下级所有用电单位

export const getCompanyListApi = (params) =>
  request.get('/pio-microservice-biz/pio/common/under/company/list', { params: { isShowAll: '1' } })

// 查询客户档案分页信息
export const getCustomerFileApi = (params) =>
  request.get('/pio-microservice-biz/pio/company-dossier/page', { params })

// 根据ID获取客户档案的明细
export const getCustomerInfoApi = (id) =>
  request.get(`/pio-microservice-biz/pio/company-dossier/detail?id=${id}`)

// 查询字典下级
export const getDictionaryApi = (dictType, parentDictValue) =>
  request.get(
    `/core/dictionary/child-combo-item/list?dictType=${dictType}&parentDictValue=${parentDictValue}`
  )

// 删除
export const delCustomerFileApi = (id) =>
  request.post(`/pio-microservice-biz/pio/company-dossier/delete?id=${id}`)

// 保存客户信息
export const saveCustomerFileApi = (params) =>
  request.post('/pio-microservice-biz/pio/company-dossier/save', params)

// 省市区接口
export const getshengshiquApi = (parentDictValue) =>
  request.get(
    `/core/dictionary/child-combo-item/list?dictType=PDYW_REGION&parentDictValue=${parentDictValue}`
  )

// 保存客户档案组织机构（步骤一）
export const saveCustomerFile1Api = (params) =>
  request.post(
    `/pio-microservice-biz/pio/company-dossier/organization/save?companyName=${params.companyName}&identityCode=${params.identityCode}&manageUserMobile=${params.manageUserMobile}&manageUserName=${params.manageUserName}`
  )

// 获取当前单位的业务范围
export const getBusinessApi = (params) =>
  request.get(
    '/pio-microservice-biz/pio/company-dossier/upper/business/scope/list',
    params
  )

// // 获取总业务范围
export const getBusinessFileApi = (params) =>
  request.get('/core/security/biz-role/list', params)

// 保存客户档案业务范围（步骤二）
export const saveCustomerFile2Api = (params) =>
  request.post(
    `/pio-microservice-biz/pio/company-dossier/authority/save?businessScope=${params.businessScope}&id=${params.id}`
  )

// 保存客户档案设备信息（步骤三）
export const saveCustomerFile3Api = (data) =>
  request.post('/pio-microservice-biz/pio/company-dossier/device/save', data)

// 保存客户档案经纬度信息（步骤四）
export const saveCustomerFile4Api = (params) =>
  request.post(
  `/pio-microservice-biz/pio/company-dossier/coordinate/save?latitude=${params.latitude}&longitude=${params.longitude}&id=${params.id}`
  )
